<?php
namespace Home\Controller;

use Common\Controller\HomeBaseController;

/**
 * 首页控制器
 */
class ResultpopupController extends HomeBaseController
{
    /**
     * 首页
     */
    public function index()
    {
        $c_type = $_GET['lottery'];
        unset($data);
        // header('Content-type:text/json');
        switch ($c_type) {
            //幸运飞艇
            case 'XYFT': //幸运飞艇 彩种id 5
                $condition['c_id'] = 5;
                // $condition['add_time'] = array(array('gt',$start_time),array('lt',$end_time)) ;
                $result = M('lottery_results')->where($condition)->Order('id desc')->limit(20)->select();
                foreach ($result as $k => $v) {
                    $data[$k]['drawNumber'] = $v['c_no'];
                    $data[$k]['drawTime']   = date('H:i', $v['add_time']);
                    $data[$k]['result']     = explode(",", $v['lottery_result']);
                    $data[$k]['lm']         = explode(",", $v['lm']);
                }
                //print_r($data);exit;
                $this->assign('data', $data);
                break;
            //北京PK10
            case 'BJPK10': //幸运飞艇 彩种id 4
                $condition['c_id'] = 4;
                // $condition['add_time'] = array(array('gt',$start_time),array('lt',$end_time)) ;
                $result = M('lottery_results')->where($condition)->Order('id desc')->limit(20)->select();
                foreach ($result as $k => $v) {
                    $data[$k]['drawNumber'] = $v['c_no'];
                    $data[$k]['drawTime']   = date('H:i', $v['add_time']);
                    $data[$k]['result']     = explode(",", $v['lottery_result']);
                    $data[$k]['lm']         = explode(",", $v['lm']);
                }
                //print_r($data);exit;
                $this->assign('data', $data);
                break;

            default:
                break;

        }

        $this->display('result-bjpk10');
    }

}
